home *** CD-ROM | disk | FTP | other *** search
/ Fritz: All Fritz / All Fritz.zip / All Fritz / FILES / PROGMISC / XLISP.LZH / XLISPSRC.ARC / XLFTAB.C < prev    next >
Text File  |  1986-06-13  |  8KB  |  268 lines

  1. /* xlftab.c - xlisp function table */
  2. /*    Copyright (c) 1985, by David Michael Betz
  3.     All Rights Reserved
  4.     Permission is granted for unrestricted non-commercial use    */
  5.  
  6. #include "xlisp.h"
  7.  
  8. /* external functions */
  9. extern NODE
  10.     *xeval(),*xapply(),*xfuncall(),*xquote(),*xfunction(),*xbquote(),
  11.     *xlambda(),*xset(),*xsetq(),*xsetf(),*xdefun(),*xdefmacro(),
  12.     *xgensym(),*xmakesymbol(),*xintern(),
  13.     *xsymname(),*xsymvalue(),*xsymplist(),*xget(),*xputprop(),*xremprop(),
  14.     *xhash(),*xmkarray(),*xaref(),
  15.     *xcar(),*xcdr(),
  16.     *xcaar(),*xcadr(),*xcdar(),*xcddr(),
  17.     *xcaaar(),*xcaadr(),*xcadar(),*xcaddr(),
  18.     *xcdaar(),*xcdadr(),*xcddar(),*xcdddr(),
  19.     *xcaaaar(),*xcaaadr(),*xcaadar(),*xcaaddr(),
  20.     *xcadaar(),*xcadadr(),*xcaddar(),*xcadddr(),
  21.     *xcdaaar(),*xcdaadr(),*xcdadar(),*xcdaddr(),
  22.     *xcddaar(),*xcddadr(),*xcdddar(),*xcddddr(),
  23.     *xcons(),*xlist(),*xappend(),*xreverse(),*xlast(),*xnth(),*xnthcdr(),
  24.     *xmember(),*xassoc(),*xsubst(),*xsublis(),*xremove(),*xlength(),
  25.     *xmapc(),*xmapcar(),*xmapl(),*xmaplist(),
  26.     *xrplca(),*xrplcd(),*xnconc(),*xdelete(),
  27.     *xatom(),*xsymbolp(),*xnumberp(),*xboundp(),*xnull(),*xlistp(),*xconsp(),
  28.     *xeq(),*xeql(),*xequal(),
  29.     *xcond(),*xcase(),*xand(),*xor(),*xlet(),*xletstar(),*xif(),
  30.     *xprog(),*xprogstar(),*xprog1(),*xprog2(),*xprogn(),*xgo(),*xreturn(),
  31.     *xcatch(),*xthrow(),
  32.     *xerror(),*xcerror(),*xbreak(),
  33.     *xcleanup(),*xtoplevel(),*xcontinue(),*xerrset(),
  34.     *xbaktrace(),*xevalhook(),
  35.     *xdo(),*xdostar(),*xdolist(),*xdotimes(),
  36.     *xminusp(),*xzerop(),*xplusp(),*xevenp(),*xoddp(),
  37.     *xfix(),*xfloat(),
  38.     *xadd(),*xsub(),*xmul(),*xdiv(),*xrem(),*xmin(),*xmax(),*xabs(),
  39.     *xadd1(),*xsub1(),*xlogand(),*xlogior(),*xlogxor(),*xlognot(),
  40.     *xsin(),*xcos(),*xtan(),*xexpt(),*xexp(),*xsqrt(),*xrand(),
  41.     *xlss(),*xleq(),*xequ(),*xneq(),*xgeq(),*xgtr(),
  42.     *xstrcat(),*xsubstr(),*xstring(),*xchar(),
  43.     *xread(),*xprint(),*xprin1(),*xprinc(),*xterpri(),
  44.     *xflatsize(),*xflatc(),
  45.     *xopeni(),*xopeno(),*xclose(),*xrdchar(),*xpkchar(),*xwrchar(),*xreadline(),
  46.     *xload(),*xtranscript(),*xgc(),*xexpand(),*xalloc(),*xmem(),
  47.     *xtype(),*xexit(),*xpeek(),*xpoke(),*xaddrs();
  48.  
  49.  
  50. /* the function table */
  51. struct fdef ftab[] = {
  52.  
  53.     /* evaluator functions */
  54. {    "EVAL",        SUBR,    xeval        },
  55. {    "APPLY",    SUBR,    xapply        },
  56. {    "FUNCALL",    SUBR,    xfuncall    },
  57. {    "QUOTE",    FSUBR,    xquote        },
  58. {    "FUNCTION",    FSUBR,    xfunction    },
  59. {    "BACKQUOTE",    FSUBR,    xbquote        },
  60. {    "LAMBDA",    FSUBR,    xlambda        },
  61.  
  62.     /* symbol functions */
  63. {    "SET",        SUBR,    xset        },
  64. {    "SETQ",        FSUBR,    xsetq        },
  65. {    "SETF",        FSUBR,    xsetf        },
  66. {    "DEFUN",    FSUBR,    xdefun        },
  67. {    "DEFMACRO",    FSUBR,    xdefmacro    },
  68. {    "GENSYM",    SUBR,    xgensym        },
  69. {    "MAKE-SYMBOL",    SUBR,    xmakesymbol    },
  70. {    "INTERN",    SUBR,    xintern        },
  71. {    "SYMBOL-NAME",    SUBR,    xsymname    },
  72. {    "SYMBOL-VALUE",    SUBR,    xsymvalue    },
  73. {    "SYMBOL-PLIST",    SUBR,    xsymplist    },
  74. {    "GET",        SUBR,    xget        },
  75. {    "PUTPROP",    SUBR,    xputprop    },
  76. {    "REMPROP",    SUBR,    xremprop    },
  77. {    "HASH",        SUBR,    xhash        },
  78.  
  79.     /* array functions */
  80. {    "MAKE-ARRAY",    SUBR,    xmkarray    },
  81. {    "AREF",        SUBR,    xaref        },
  82.  
  83.     /* list functions */
  84. {    "CAR",        SUBR,    xcar        },
  85. {    "CDR",        SUBR,    xcdr        },
  86.  
  87. {    "CAAR",        SUBR,    xcaar        },
  88. {    "CADR",        SUBR,    xcadr        },
  89. {    "CDAR",        SUBR,    xcdar        },
  90. {    "CDDR",        SUBR,    xcddr        },
  91.  
  92. {    "CAAAR",    SUBR,    xcaaar        },
  93. {    "CAADR",    SUBR,    xcaadr        },
  94. {    "CADAR",    SUBR,    xcadar        },
  95. {    "CADDR",    SUBR,    xcaddr        },
  96. {    "CDAAR",    SUBR,    xcdaar        },
  97. {    "CDADR",    SUBR,    xcdadr        },
  98. {    "CDDAR",    SUBR,    xcddar        },
  99. {    "CDDDR",    SUBR,    xcdddr        },
  100.  
  101. {    "CAAAAR",    SUBR,    xcaaaar        },
  102. {    "CAAADR",    SUBR,    xcaaadr        },
  103. {    "CAADAR",    SUBR,    xcaadar        },
  104. {    "CAADDR",    SUBR,    xcaaddr        },
  105. {    "CADAAR",    SUBR,    xcadaar        },
  106. {    "CADADR",    SUBR,    xcadadr        },
  107. {    "CADDAR",    SUBR,    xcaddar        },
  108. {    "CADDDR",    SUBR,    xcadddr        },
  109. {    "CDAAAR",    SUBR,    xcdaaar        },
  110. {    "CDAADR",    SUBR,    xcdaadr        },
  111. {    "CDADAR",    SUBR,    xcdadar        },
  112. {    "CDADDR",    SUBR,    xcdaddr        },
  113. {    "CDDAAR",    SUBR,    xcddaar        },
  114. {    "CDDADR",    SUBR,    xcddadr        },
  115. {    "CDDDAR",    SUBR,    xcdddar        },
  116. {    "CDDDDR",    SUBR,    xcddddr        },
  117.  
  118. {    "CONS",        SUBR,    xcons        },
  119. {    "LIST",        SUBR,    xlist        },
  120. {    "APPEND",    SUBR,    xappend        },
  121. {    "REVERSE",    SUBR,    xreverse    },
  122. {    "LAST",        SUBR,    xlast        },
  123. {    "NTH",        SUBR,    xnth        },
  124. {    "NTHCDR",    SUBR,    xnthcdr        },
  125. {    "MEMBER",    SUBR,    xmember        },
  126. {    "ASSOC",    SUBR,    xassoc        },
  127. {    "SUBST",    SUBR,    xsubst        },
  128. {    "SUBLIS",    SUBR,    xsublis        },
  129. {    "REMOVE",    SUBR,    xremove        },
  130. {    "LENGTH",    SUBR,    xlength        },
  131. {    "MAPC",        SUBR,    xmapc        },
  132. {    "MAPCAR",    SUBR,    xmapcar        },
  133. {    "MAPL",        SUBR,    xmapl        },
  134. {    "MAPLIST",    SUBR,    xmaplist    },
  135.  
  136.     /* destructive list functions */
  137. {    "RPLACA",    SUBR,    xrplca        },
  138. {    "RPLACD",    SUBR,    xrplcd        },
  139. {    "NCONC",    SUBR,    xnconc        },
  140. {    "DELETE",    SUBR,    xdelete        },
  141.  
  142.     /* predicate functions */
  143. {    "ATOM",        SUBR,    xatom        },
  144. {    "SYMBOLP",    SUBR,    xsymbolp    },
  145. {    "NUMBERP",    SUBR,    xnumberp    },
  146. {    "BOUNDP",    SUBR,    xboundp        },
  147. {    "NULL",        SUBR,    xnull        },
  148. {    "NOT",        SUBR,    xnull        },
  149. {    "LISTP",    SUBR,    xlistp        },
  150. {    "CONSP",    SUBR,    xconsp        },
  151. {    "MINUSP",    SUBR,    xminusp        },
  152. {    "ZEROP",    SUBR,    xzerop        },
  153. {    "PLUSP",    SUBR,    xplusp        },
  154. {    "EVENP",    SUBR,    xevenp        },
  155. {    "ODDP",        SUBR,    xoddp        },
  156. {    "EQ",        SUBR,    xeq        },
  157. {    "EQL",        SUBR,    xeql        },
  158. {    "EQUAL",    SUBR,    xequal        },
  159.  
  160.     /* control functions */
  161. {    "COND",        FSUBR,    xcond        },
  162. {    "CASE",        FSUBR,    xcase        },
  163. {    "AND",        FSUBR,    xand        },
  164. {    "OR",        FSUBR,    xor        },
  165. {    "LET",        FSUBR,    xlet        },
  166. {    "LET*",        FSUBR,    xletstar    },
  167. {    "IF",        FSUBR,    xif        },
  168. {    "PROG",        FSUBR,    xprog        },
  169. {    "PROG*",    FSUBR,    xprogstar    },
  170. {    "PROG1",    FSUBR,    xprog1        },
  171. {    "PROG2",    FSUBR,    xprog2        },
  172. {    "PROGN",    FSUBR,    xprogn        },
  173. {    "GO",        FSUBR,    xgo        },
  174. {    "RETURN",    FSUBR,    xreturn        },
  175. {    "DO",        FSUBR,    xdo        },
  176. {    "DO*",        FSUBR,    xdostar        },
  177. {    "DOLIST",    FSUBR,    xdolist        },
  178. {    "DOTIMES",    FSUBR,    xdotimes    },
  179. {    "CATCH",    FSUBR,    xcatch        },
  180. {    "THROW",    FSUBR,    xthrow        },
  181.  
  182.     /* debugging and error handling functions */
  183. {    "ERROR",    SUBR,    xerror        },
  184. {    "CERROR",    SUBR,    xcerror        },
  185. {    "BREAK",    SUBR,    xbreak        },
  186. {    "CLEAN-UP",    SUBR,    xcleanup    },
  187. {    "TOP-LEVEL",    SUBR,    xtoplevel    },
  188. {    "CONTINUE",    SUBR,    xcontinue    },
  189. {    "ERRSET",    FSUBR,    xerrset        },
  190. {    "BAKTRACE",    SUBR,    xbaktrace    },
  191. {    "EVALHOOK",    SUBR,    xevalhook    },
  192.  
  193.     /* arithmetic functions */
  194. {    "TRUNCATE",    SUBR,    xfix        },
  195. {    "FLOAT",    SUBR,    xfloat        },
  196. {    "+",        SUBR,    xadd        },
  197. {    "-",        SUBR,    xsub        },
  198. {    "*",        SUBR,    xmul        },
  199. {    "/",        SUBR,    xdiv        },
  200. {    "1+",        SUBR,    xadd1        },
  201. {    "1-",        SUBR,    xsub1        },
  202. {    "REM",        SUBR,    xrem        },
  203. {    "MIN",        SUBR,    xmin        },
  204. {    "MAX",        SUBR,    xmax        },
  205. {    "ABS",        SUBR,    xabs        },
  206. {    "SIN",        SUBR,    xsin        },
  207. {    "COS",        SUBR,    xcos        },
  208. {    "TAN",        SUBR,    xtan        },
  209. {    "EXPT",        SUBR,    xexpt        },
  210. {    "EXP",        SUBR,    xexp        },
  211. {    "SQRT",        SUBR,    xsqrt        },
  212. {    "RANDOM",    SUBR,    xrand        },
  213.  
  214.     /* bitwise logical functions */
  215. {    "LOGAND",    SUBR,    xlogand        },
  216. {    "LOGIOR",    SUBR,    xlogior        },
  217. {    "LOGXOR",    SUBR,    xlogxor        },
  218. {    "LOGNOT",    SUBR,    xlognot        },
  219.  
  220.     /* numeric comparison functions */
  221. {    "<",        SUBR,    xlss        },
  222. {    "<=",        SUBR,    xleq        },
  223. {    "=",        SUBR,    xequ        },
  224. {    "/=",        SUBR,    xneq        },
  225. {    ">=",        SUBR,    xgeq        },
  226. {    ">",        SUBR,    xgtr        },
  227.  
  228.     /* string functions */
  229. {    "STRCAT",    SUBR,    xstrcat        },
  230. {    "SUBSTR",    SUBR,    xsubstr        },
  231. {    "STRING",    SUBR,    xstring        },
  232. {    "CHAR",        SUBR,    xchar        },
  233.  
  234.     /* I/O functions */
  235. {    "READ",        SUBR,    xread        },
  236. {    "PRINT",    SUBR,    xprint        },
  237. {    "PRIN1",    SUBR,    xprin1        },
  238. {    "PRINC",    SUBR,    xprinc        },
  239. {    "TERPRI",    SUBR,    xterpri        },
  240. {    "FLATSIZE",    SUBR,    xflatsize    },
  241. {    "FLATC",    SUBR,    xflatc        },
  242.  
  243.     /* file I/O functions */
  244. {    "OPENI",    SUBR,    xopeni        },
  245. {    "OPENO",    SUBR,    xopeno        },
  246. {    "CLOSE",    SUBR,    xclose        },
  247. {    "READ-CHAR",    SUBR,    xrdchar        },
  248. {    "PEEK-CHAR",    SUBR,    xpkchar        },
  249. {    "WRITE-CHAR",    SUBR,    xwrchar        },
  250. {    "READ-LINE",    SUBR,    xreadline    },
  251.  
  252.     /* system functions */
  253. {    "LOAD",        SUBR,    xload        },
  254. {    "TRANSCRIPT",    SUBR,    xtranscript    },
  255. {    "GC",        SUBR,    xgc        },
  256. {    "EXPAND",    SUBR,    xexpand        },
  257. {    "ALLOC",    SUBR,    xalloc        },
  258. {    "MEM",        SUBR,    xmem        },
  259. {    "TYPE-OF",    SUBR,    xtype        },
  260. {    "EXIT",        SUBR,    xexit        },
  261. {    "PEEK",        SUBR,    xpeek        },
  262. {    "POKE",        SUBR,    xpoke        },
  263. {    "ADDRESS-OF",    SUBR,    xaddrs        },
  264.  
  265. {    0                    }
  266. };
  267.  
  268.